    function getXMLHTTP() { //fuction to return the xml http object
        var xmlhttp=false;	
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e)	{		
            try{			
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }
		 	
        return xmlhttp;
    }
    
    function getCarModel(makeID,baseUrl,divID) 
    {		
        var strURL=baseUrl+"ajax/populate_cal_model/"+makeID+"/"+divID;
        //alert(strURL);
        var req = getXMLHTTP();
        if (req) {
            req.onreadystatechange = function() 
            {
                if (req.readyState == 4) {
                    if (req.status == 200) {
                        document.getElementById(divID).innerHTML=req.responseText;
                    } else {
                        alert("There was a problem while using Car Model:\n" + req.statusText);
                    }
                }				
            }			
            req.open("GET", strURL, true);
            req.send(null);
        }
    }

    function getCarVersion(modelID,baseUrl) 
    {		
        var strURL=baseUrl+"ajax/populate_car_version/"+modelID;
        var req = getXMLHTTP();
        //alert(strURL);
        if (req) {
            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    //alert(divID);                                
                    if (req.status == 200) {
                        document.getElementById('ver_div').innerHTML=req.responseText;
                    } else {
                        alert("There was a problem while using Car Version:\n" + req.statusText);
                    }
                }				
            }			
            req.open("GET", strURL, true);
            req.send(null);
        }
    
    }
    
    function getCity(stateId,baseUrl,citydiv) {		
    var strURL=baseUrl+"ajax/populate_city/"+stateId+"/"+citydiv;
    //alert(strURL);            
    var req = getXMLHTTP();
    if (req) {
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
				//alert(strURL); 
                if (req.status == 200) {
					//alert(strURL); 
                    document.getElementById(citydiv).innerHTML=req.responseText;
                } else {
                    alert("There was a problem while using City:\n" + req.statusText);
                }
            }				
        }			
        req.open("GET", strURL, true);
        req.send(null);
    }
}
